package com.springmvc.api.task;

import org.apache.log4j.Logger;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * Created by cheng.xi on 12/10/15.
 */
@Component
public class TestTask {

    Logger LOGGER = Logger.getLogger(TestTask.class);

    @Scheduled(cron="0/5 * *  * * ? ")   //每5秒执行一次
    public void testTask(){
        LOGGER.info("开始定时器任务");
        LOGGER.info("每隔5秒执行一次");
    }
}
